home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / patches / pgs3f.lha / 3.0fUpdate / Macros.LHA / SendtoTurboText.rexx < prev    next >
OS/2 REXX Batch file  |  1994-12-20  |  3KB  |  105 lines

  1. /* $VER: SendtoTurboText.rexx 1.1 (20.12.94)
  2.    Copyright 1994 Soft-Logik Publishing Corporation
  3.    May not be distributed without Soft-Logik Publishing Corporation's express written permission */
  4.  
  5. OPTIONS RESULTS
  6. TRACE OFF
  7.  
  8. /* Make sure rexx support is opened */
  9. IF ~SHOW('L','rexxsupport.library') THEN
  10.    CALL ADDLIB('rexxsupport.library',0,-30)
  11.  
  12. ADDRESS 'PAGESTREAM'
  13.  
  14.  
  15. /* If text is not selected, select the current article */
  16. getcursor characterstart sID characterend eID
  17. if sID=eID then 'selecttext all'
  18.  
  19. /* Export the article to a temp file */
  20. 'lockinterface true'
  21. 'exporttext file t:HotLinkedArticle filter ascii textcode PageStream status force'
  22. /* Eventually will just make article external, but not this version */
  23. /* 'editarticle external file t:HotLinkedArticle' */
  24. 'refresh wait'
  25.  
  26. /* set the default TurboText path */
  27. ttxpath='TurboText:TTX'
  28. preffile='PageStream3:SendtoTurboText.prefs'
  29.  
  30. /* If TurboText doesn't exist in the default path, check SendtoTurboText.prefs */
  31. if ~exists(ttxpath) then do
  32.     if open(.ifile, preffile, 'R') then do
  33.         ttxpath=readln(.ifile)
  34.         call close(.ifile)
  35.         askuser='no'
  36.         end
  37.     else do
  38.         askuser='yes'
  39.     end
  40.     /* If TurboText doesn't exist in the set pref path, ask the user where it is */
  41.     if ~exists(ttxpath) | askuser='yes' then do
  42.         getfile TITLE "'Please locate TurboText'" load path "'TurboText:'" file 'TTX' posbutton 'Ok' negbutton 'Cancel'
  43.         if RC=10 then signal cancel
  44.         ttxpath=result
  45.         if open(.ifile, preffile, 'W') then do
  46.             call writeln(.ifile, ttxpath)
  47.             call close(.ifile)
  48.         end
  49.     end
  50. end
  51.  
  52.  
  53. /* Run TurboText */
  54. ADDRESS COMMAND
  55. 'run >nil:' ttxpath' t:HotLinkedArticle'
  56.  
  57. /* Wait until the ARexx port shows up */
  58. do 20
  59.     if ~show(P, 'TURBOTEXT') then call delay(50)
  60. end
  61.  
  62. /* If the ARexx port didn't show up, alert the user and exit */
  63. if ~show(P, 'TURBOTEXT') then do
  64.     ADDRESS 'PAGESTREAM'
  65.     allocarexxrequester '"Send to Editor Error!"' 368 59
  66.     reqhandle=result
  67.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  68.         Exithandle=result
  69.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'TurboText could not be started.'"
  70.     doarexxrequester reqhandle
  71.     freearexxrequester reqhandle
  72.     'refresh continue'
  73.     'lockinterface false'
  74.     EXIT
  75. end
  76.  
  77. /* Wait for the user to finish in TurboText */
  78. do forever
  79.     if show(P, 'TURBOTEXT') then call delay(50)
  80.         else signal update
  81. end
  82.  
  83. /* Update PageStream and exit */
  84. UPDATE:
  85. ADDRESS 'PAGESTREAM'
  86. 'screentofront'
  87. /* Eventually will just make article external, but not this version */
  88. /* 'editarticle path t:HotLinkedArticle' */
  89. /* 'editarticle internal' */
  90.  
  91. 'inserttext file t:HotLinkedArticle filter ascii textcode PageStream'
  92.  
  93. /* deselect the text if rquired */
  94. if sID=eID then selecttext none
  95.  
  96. signal cancel
  97.  
  98. CANCEL:
  99. ADDRESS 'PAGESTREAM'
  100. 'refresh continue'
  101. 'lockinterface false'
  102. ADDRESS COMMAND
  103. 'delete t:HotLinkedArticle'
  104. EXIT
  105.